<?php

namespace App\Models;

use App\Enums\MessagePublishStatus;
use BenSampo\Enum\Traits\CastsEnums;

/**
 * @mixin IdeHelperMessageTemplate
 */
class MessageTemplate extends BaseModel
{
    use CastsEnums;

    protected $casts = [
        'publish_status' => MessagePublishStatus::class,
    ];

    public function receivers()
    {
        return $this->hasMany(MessageReceiver::class, 'template_id');
    }

    public function messages()
    {
        return $this->hasMany(Notice::class, 'template_id');
    }
}
